import {create} from 'zustand';
import {immer} from 'zustand/middleware/immer';
import {Device} from '../types';
const useAppStore = create(
  immer<{
    curDevice: Device;
  }>(() => {
    return {
      curDevice: {name: '', ip: ''},
    };
  }),
);
export default useAppStore;

export function setCurDevice(device: Device) {
  useAppStore.setState(state => {
    state.curDevice = device;
  });
}
